package cn.hnwlgc.mapper;

import cn.hnwlgc.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper{

    @Select("select * from t_user where id = #{id}")
    User getById(Integer id);

    @Select("select * from t_user where name = #{name} and password = #{password}")
    User getByUsernameAndPassword(User user);

    @Insert("insert into t_user(name,phone,password,image) values(#{name},#{password},#{phone},#{image})")
    void add(User user);

    @Update("update t_user set name = #{name},phone = #{phone},image = #{image} where id = #{id}")
    void update(User user);
}
